<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title></title>
</head>
<body>

	<div class="box"></div>
	<script src="jquery.js"></script>
	<script>
		$(function () {

			// 	https://free-api.heweather.com/s6/weather/now?location=beijing&key=4693ff5ea653469f8bb0c29638035976 

				//加载第一个和风天气的数据

				// setTimeout(init,2000)
				

				//函数对象
				var init = function(){
					$.ajax({
					url:`https://free-api.heweather.com/s6/weather/now?location=beijing&key=4693ff5ea653469f8bb0c29638035976`,
					type:'get',
					success:function (data) {

						console.log(data);
						console.log(data.HeWeather6[0].now.tmp);
						console.log(data.HeWeather6[0].now.cond_txt);

						var tmp = data.HeWeather6[0].now.tmp;

						var nowTmp = `${tmp}℃`;

						$('.box').html(nowTmp)


					},
					error:function (err) {
						console.log(err);
					}
				});
				}
				

				setTimeout(init,2000)
				

				

			});

	
	</script>
</body>
</html>